package h0725;

import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class MinNumberWithArray2 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        String[] nums = sc.nextLine().split(",");

        Arrays.sort(nums,(a,b)->Integer.parseInt(a)-Integer.parseInt(b));
        String[] temp=Arrays.copyOfRange(nums,0,Math.min(3,nums.length));
        // 对字符串数组进行排序
        Arrays.sort(temp, (o1, o2) -> (o1 + o2).compareTo(o2 + o1));

        StringBuilder result=new StringBuilder();
        for (String s : temp) {
            result.append(s);
        }

        System.out.println(result.toString());
    }
}
